package com.bank.validator;


import com.bank.annotation.ValidAccountType;
import com.bank.constant.AccountType;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class AccountTypeValidator implements ConstraintValidator<ValidAccountType, Integer> {

    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        return AccountType.SAVINGS.equals(value) || AccountType.CREDIT.equals(value);
    }
}

